package com.zone.types.event;

import lombok.Getter;

import java.io.Serializable;

/**
 * @author: zongzi
 * @description: 消息对象
 * @date: 2025/2/16
 */
public class BaseMessage<T> implements Serializable {
    /** 消息数据 */
    @Getter
    private T data;
    /** 时间搓 */
    @Getter
    private Long timestamp;

    public BaseMessage() {
    }

    public BaseMessage(T data) {
        this.data = data;
        this.timestamp = System.currentTimeMillis();
    }

    public BaseMessage(T data, Long timestamp) {
        this.data = data;
        this.timestamp = timestamp;
    }

    @Override
    public String toString() {
        return "BaseMessage{" +
                "data=" + data +
                ", timestamp=" + timestamp +
                '}';
    }
}
